package monopoly;

import javax.swing.JOptionPane;

public class Tax {
	
	private double taxAmount;
	private double taxRate;
	private int taxType;
	
	public Tax()
	{
		taxAmount = 0.0;
		taxRate = 0.0;
		taxType = 0;
	}
	
	public Tax(int taxType, double taxAmount, double taxRate)
	{
		this.taxType = taxType;
		this.taxAmount = taxAmount;
		this.taxRate = taxRate;
	}
	
	public double getTaxAmount(Player player)
	{
		switch (taxType)
		{
		case 1: return taxAmount;
		case 2: 
			int response = JOptionPane.showConfirmDialog(null,"Income tax due:  " + this.taxAmount +
					"\n\nDo you want do pay 10% of net worth instead?\n", "Income Tax", 0);
			if (response == 0)
			{
				int taxInt = (int)(player.getNetWorth() * taxRate);
				double taxDbl = (double)(taxInt);
				return taxDbl;
			} else 
				return taxAmount;
		}
		return taxAmount;
	}

}
